package com.base;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.internal.util.AlipaySignature;
/**
 * 参数类
 * @author admin
 *
 */
public class Constant {
	public static final String UTF8 = "UTF-8";
	public static final String dataStr = "record";
	public static final String dataListStr = "recordList";
	public static final String RESOURCE_PATH = "RESOURCE_PATH";
	public static final String MEMBER_IMG = "MEMBER_IMG";
	public static final String COMPANY_IMG = "COMPANY_IMG";
	public static long time = 0;
	public static int urlCode = 0;
	private static String alipayAppId = "2021001169629176";// appid
	private static String alipayPrivateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCSvqT7kay86io1xZzv6sVeWXCAh9r1GOqKI+ahCe7tObu6e9xIpGnTHF7HQNNgxGYqcnlkTJdU4MbKlGiClSmGLzg0tCqJ/AdI0Wqx2PQMbbYnUFfFqXjjns5eeUEBBcwL5Va6l+SY9DrQnGCHJl1EVsazYM6fKNpDpeZcSMyVidn4OVcNw3vUMzbRIHO8khoNGjx4hu/iZ6EQWs/unWV2hTC6T/q68ejC03MfshHxsrTIB4MdVaLRXNPm0t4tMQRkv+IhYrO/gYgIkgFVD+oVugVgcnliLmB6bYGenCvbs2/00iiVwc+5zZuLZrw/C3bn3O8JI7FnT0NzC4utvuWBAgMBAAECggEAaLwG1sKPLjpXLA/Bxf6jJYbiY+oS3bIN29Bpz/BeBhSZpyy1+WbXXOS3xLDA7STf4lXXzD1aGStg1r97pA/AFlRnYj5gyiEGNfO5mfvFm4VGZ+LQ8nPVo2f51LXoLkmr66Wg9AZrErvlqnSh9HPuR1ND+E0Uy8YFmhizRJR06BjnjVtvhwM9Rlkr3cQQPRwV6YLZq9g+EAEpqbBVSC57BwlYavCo2PraEo+0B40Vv9aXFS8cfMRHyX1HBoFpMUHpBvhVOonuz2vP3rkWcIEoT0Xp/cxIr5509pyW8IrOwj93bWJh5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58IBe9YqtviV3Cpxe1vj56K6B9pYQ1yvsVPlcRwBkuAc6M2u7ZIwIZQaeRpVzivGomNWFWg3cpjVtBxe+DhJjBmNQ4Y01Jsu2jPhtGfXzhtXX+wdnk3jjnjpSbRAPh27KhypmwGGxOA06BCCRl7HI8e0AARkT9Ej2KzDQv7xJpFCGP/AtYOjCazVrhVHN+s4fXTh8e0Q6F4SoLOFbaI0B6k8mxqQvrn2QIDAQAB";
	// 服务器异步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://127.0.0.1:80/alipay/notice";
	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	// public static String return_url =
	// "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";
	public static String alipayNo = "2088631970549875";// 登陆人信息
	public static String alipayLoginName = "307168036@qq.com";// 登陆人信息
	private static AlipayClient alipayClient;
	public static String ZFB_NOTIFY_URL = "ZFB_NOTIFY_URL";

	/**
	 * 公司团建
	 */
	public static final String COMPANY_IMG_LIST = "COMPANY_IMG_LIST";

	public static final String OPEN_ID = "OPEN_ID";

	public static final String MEMBER = "MEMBER";

	public static final String BANNER_IMG = "BANNER_IMG";

	public static final String COMPANY = "COMPANY";
	public static final String ONE = "1";

	public static final String ZERO = "0";
	public static final String IS_DELETED_NO = "0";
	public static final String IS_DELETED_YES = "1";
	public static final String ORDER_PRODUCT = "ORDER_PRODUCT";
	public static final String TWO = "2";
	public static final String ORDER_TIMEOUT_STOP = "ORDER_TIMEOUT_STOP";
	public static final String PROJECT_IMG = "PROJECT_IMG";
	public static final String ORDER_SHOW_STOP = "ORDER_SHOW_STOP";
	public static final String THREE = "3";
	public static final String FOUR = "4";
	// 待支付订单限定的关闭时间，对应字典表中的code
	public static String PAY_ORDER_REMOVE = "PAY_ORDER_REMOVE";

	//创建纪念馆的图片
	public static String CREATEMEMORIAlHALL = "CREATEMEMORIAlHALL";

	public static void setUrl(int url) {
		time = System.currentTimeMillis();
		urlCode = url;
	}

	public static boolean rsaCheckV1(Map<String, String> params) throws AlipayApiException {
		return AlipaySignature.rsaCheckV1(params, alipayPublicKey, "utf-8", "RSA2");
	}

	private static SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmssSSS");
	public static String kuaidi_customer = "KUAIDI_CUSTOMER";
	public static String kuaidi_key = "KUAIDI_KEY";

	public synchronized static String orderId() {
		String date = fmt.format(new Date());
		int v = (int) (Math.random() * 9000);
		String orderNumber = date + (v + 1000);
		return orderNumber;
	}

	public static void main(String[] args) {
		System.out.println(new Double(0.0) == 0);
	}

	public static long getTotalPageByTotalNum(long totalNum, int limit) {
		long page = 0;
		if (totalNum % limit == 0) {
			page = totalNum / limit;
		} else {
			page = totalNum / limit + 1;
		}
		return page;
	}

	public static long getTotalPageByTotalNum(long totalNum, Object rows) {
		long page = 0;
		int limit = Integer.parseInt(rows + "");
		if (totalNum % limit == 0) {
			page = totalNum / limit;
		} else {
			page = totalNum / limit + 1;
		}
		return page;
	}
}
